/*
 * Copyright (C) 2011  John Lawrence thegordo.john at gmail.com
 * Licensed under GPLv3 or later. see http://www.gnu.org/copyleft/gpl.html
 */

package org.jklawrencefam.model.email;

import java.util.Set;
import java.util.TreeSet;

/**
 * User: John Lawrence
 * Date: 6/9/11
 * Time: 11:36 PM
 */
public class Message {
    private Address from;
    private Set<Address> recipients;
    private String data;

    public Message() {
        recipients = new TreeSet<Address>();
    }

    public Address getFrom() {
        return from;
    }

    public void setFrom(Address from) {
        if (from != null && from.getType() == AddressType.From) {
            this.from = from;
        }
    }

    public Set<Address> getRecipients() {
        return recipients;
    }

    public void setRecipients(Set<Address> recipients) {
        this.recipients = recipients;
    }

    public void addRecipient(Address address) {
        if (address != null && address.getType() != AddressType.From) {
            recipients.add(address);
        }
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
